package videoExercises;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class Test6 {
    public static void main(String[] args) {
        Map<String ,String> m =new HashMap<>();
        m.put("小头爸爸","大头儿子");
        m.put("猪猪侠","超人强");
        m.put("熊大","熊二");

        Set<String> s = m.keySet();
        //迭代器遍历
        /*Iterator<String> iterator = s.iterator();
        while(iterator.hasNext()){
            String next =iterator.next();
            String s1 = m.get(next);
            System.out.println(next +"="+s1);
        }*/

        //增强for循环遍历
        /*for (String s1 : s) {
            String s2=m.get(s1);
            System.out.println(s1+"="+s2);
        }*/
        //lambda表达式遍历
        s.forEach(s1->{
            String s3=m.get(s1);
            System.out.println(s1+"="+s3);
        });
    }
}
